//
//  LTNetwrokTool.m
//  wangyiNews08
//
//  Created by 123 on 16/3/11.
//  Copyright © 2016年 Tsr. All rights reserved.
//

#import "LTNetwrokTool.h"

@implementation LTNetwrokTool

+ (instancetype) shareNetwrokTool {
    static LTNetwrokTool *instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        // 基地址
        /*
         http://c.m.163.com/nc/ad/headline/0-4.html
         http://c.m.163.com/nc/article/headline/T1348647853363/0-140.html
         
         /ad/headline/0-4.html
         article/headline/T1348647853363/0-140.html
         */
        NSURL *baseURL = [NSURL URLWithString:@"http://c.m.163.com/nc/"];
        // 创建会话配置对象
        NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
        // 请求时常
        config.timeoutIntervalForRequest = 15.0;
        instance = [[self alloc] initWithBaseURL:baseURL sessionConfiguration:config];
        
        instance.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html", nil];
    });
    return instance;
}

@end
